package com.dawn.login.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.dawn.usermanage.bean.UserBean;

@Repository
public class LoginDao {

    @Autowired
    private HibernateTemplate hibernateTemplate;

    public List<UserBean> findUser(String name, String passwd) {
        @SuppressWarnings("unchecked")
        List<UserBean> users = (List<UserBean>) hibernateTemplate.find(
                "from UserBean u where u.userName = ? and u.password = ?", name, passwd);
        return users;
    }

    public void updateLoginTime(UserBean userBean) {
        hibernateTemplate.update(userBean);
    }

}
